<%@page import="ca.lscs.model.Checklist"%>
<%@page import="ca.lscs.model.AppUser"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<%
		Checklist checklist = (Checklist)request.getAttribute("checklist");
		List<AppUser> surveyors = (List<AppUser>)request.getAttribute("surveyors");
	%>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<link rel="stylesheet" type="text/css" href="/css/lscs.css" />
		<title>LSCS</title>
	</head>
	<body>
		<%@include file="header.jsp"%>
		<div style="float:left;">
			<form action="/checklist/edit/<%=checklist.getId()%>" method="post">
				<label for="title">Title</label>
				<br/>
				<input type="text" name="title" value="<%=checklist.getTitle()%>"/>
				<br/>
				<label for="description">Description</label>
				<br/>
				<textarea name="description" rows="5" cols="50"><%=checklist.getDescription()%></textarea>
				<br/>
				<label for="filenumber">File Number</label>
				<br/>
				<input type="text" name="filenumber" value="<%=checklist.getFileNumber()%>" />
				<br/>
				<label for="landdistrict">Land District</label>
				<br/>
				<input type="text" name="landdistrict" value="<%=checklist.getLandDistrict()%>" />
				<br/>
				<label for="address">Address</label>
				<br/>
				<input type="text" name="address" value="<%=checklist.getAddress()%>" />
				<br/>
				<label for="asignee">Asignee</label>
				<br/>
				<select name="asignee">
				<%for(AppUser surveryor : surveyors) {%>
					<%if(checklist.getAsignee().getId() == surveryor.getId()) {%>
					<option value="<%=surveryor.getId()%>" selected="selected">
						<%=surveryor.getFirstName()%> <%=surveryor.getLastName()%>
					</option>
					<%} else {%>
					<option value="<%=surveryor.getId()%>">
						<%=surveryor.getFirstName()%> <%=surveryor.getLastName()%>
					</option>
					<%}%>
				<%}%>
				</select>
				<br/>
				<br/>
				<button type="submit"class="action">Save</button>
			</form>
		</div>
	</body>
</html>